package org.agony2d.display.core.supportClasses {
	import flash.display.Sprite
	import flash.geom.Point;
	import org.agony2d.core.agony_internal;
	
	use namespace agony_internal;
	
public class RecyclableComp extends Sprite {
	
    public function RecyclableComp() {
		m_scaleX = m_scaleY = m_alpha = 1
		m_rotation = 0
    }
	
	override public function set scaleX( v:Number ) : void {
		super.scaleX = m_scaleX = v
	}
	
	override public function set scaleY( v:Number ) : void { 
		super.scaleY = m_scaleY = v
	}
	
	override public function set rotation( v:Number ) : void {
		super.rotation = m_rotation = v
	}
	
	override public function set alpha( v:Number ) : void {
		super.alpha = m_alpha = v
	}
	
	agony_internal function reset() : void {
		if (m_rotation != 0) {
			super.rotation = m_rotation = 0
		}
		if (m_scaleX != 1 || m_scaleY != 1) {
			super.scaleX = m_scaleX = super.scaleY = m_scaleY = 1
		}
		if (m_alpha != 1) {
			super.alpha = m_alpha = 1
		}
		this.x = this.y = 0
	}
	
	
	agony_internal static var g_cachedPoint:Point
	
	agony_internal var m_scaleX:Number
	agony_internal var m_scaleY:Number
	agony_internal var m_alpha:Number
	agony_internal var m_rotation:Number
	
	
	/** overwrite */
	agony_internal function recycle() : void {
		
	}
	
	agony_internal function dispose() : void {
		if (this.parent) {
			this.parent.removeChild(this)
		}
		this.reset()
		this.recycle()
	}
}
}